import { defineStore } from 'pinia'
import { reactive } from 'vue'

export interface shopConfig {
    playAudio: boolean
    unreadCount: number
    notify: boolean
}

export const useShopConfig = defineStore(
    'shopConfig',
    () => {
        const state = reactive<shopConfig>({
            playAudio: false,
            unreadCount: 0,
            notify: false,
        })

        const dataFill = (data: shopConfig) => {
            Object.assign(state, data)
        }

        const changePlayAudio = () => {
            state.playAudio = !state.playAudio
        }

        return {
            state,
            dataFill,
            changePlayAudio,
        }
    },
    {
        persist: {
            key: 'shopConfig',
        },
    }
)
